package com.wxp.demo03.text;

import android.os.Bundle;
import android.widget.TextView;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

import com.wxp.demo03.R;

/**
 * 1.2设置文本的大小
 */
public class TextSizeActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        this.setTitle("1.2设置文本的大小");
        super.onCreate(savedInstanceState);
        EdgeToEdge.enable(this);
        setContentView(R.layout.activity_text_size);

        //设置字体大小
        TextView textView = findViewById(R.id.textView3);
        textView.setTextSize(16);
        TextView textView2 = findViewById(R.id.textView4);
        textView2.setTextSize(26);
        TextView textView3 = findViewById(R.id.textView5);
        textView3.setTextSize(36);

        ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.text_size), (v, insets) -> {
            Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
            v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
            return insets;
        });
    }
}